package com.mapper;

import com.entity.ProductReviews;
import com.entity.ReviewReplies;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @InterfaceName ProductReviewsMapper
 * @Description 商品评论主表持久层接口
 * @Author Kx
 * @Date 2025/6/9 8:54
 * @Version 1.0
 */
public interface ProductReviewsMapper {
    /**
     * @author: kx
     * @date: 2025/6/9 9:03
     * @param productReviews : 商品评论信息
     * @description: 添加商品评论信息
    */
    void addProductReview(@Param("productReviews") ProductReviews productReviews);

    /**
     * @author: kx
     * @date: 2025/6/10 8:39
     * @param productReviews : 商品评论信息
     * @description: 修改商品评论状态
    */
    void updateStatus(@Param("productReviews") ProductReviews productReviews);

    /**
     * @author: kx
     * @date: 2025/6/10 8:50
     * @param productId : 商品ID
     * @return java.util.List<com.entity.ProductReviews>
     * @description: 根据商品编号查询该商品的所有评论
    */
    List<ProductReviews> findByProductId(@Param("productId") Integer productId);

    /**
     * @author: kx
     * @date: 2025/6/10 11:14
     * @param reviewId : 评论ID
     * @return java.util.List<com.entity.ReviewReplies>
     * @description: 根据评论ID查询该评论下的所有回复
    */
    List<ReviewReplies> findRepliesByReviewId(@Param("reviewId") Long reviewId);

    /**
     * @author: kx
     * @date: 2025/6/10 15:59
     * @param reviewId : 评论ID
     * @return com.entity.ProductReviews
     * @description: 根据评论ID查询此评论信息
    */
    ProductReviews findByReviewId(@Param("reviewId") Long reviewId);

    /**
     * @author: kx
     * @date: 2025/6/10 16:27
     * @param replyId : 回复ID
     * @return com.entity.ReviewReplies
     * @description: 根据回复ID查询此回复信息
    */
    ReviewReplies findReplyById(@Param("replyId") Long replyId);

    /**
     * @author: kx
     * @date: 2025/6/10 19:10
     * @param parentReplyId : 父回复ID
     * @return java.util.List<com.entity.ReviewReplies>
     * @description: 根据父回复ID查询此父回复的子回复信息
    */
    List<ReviewReplies> findRepliesByParentId(@Param("parentReplyId") Long parentReplyId);

    /**
     * @author: kx
     * @date: 2025/6/10 20:32
     * @param reviewReplies : 评论回复信息
     * @description: 添加评论回复信息
    */
    void addReviewReplies(@Param("reviewReplies") ReviewReplies reviewReplies);

    /**
     * @author: kx
     * @date: 2025/6/10 20:52
     * @param reviewReplies : 评论回复信息
     * @description: 修改评论回复信息状态
    */
    void updateReviewReplies(@Param("reviewReplies") ReviewReplies reviewReplies);
}
